#ifndef THREADMODEL_H
#define THREADMODEL_H

#include <QAbstractItemModel>
#include "components/threadptr.h"

class ThreadModel : public QAbstractItemModel
{
	Q_OBJECT
public:
	explicit ThreadModel(const Wishmaster::ThreadPtr& thread, QObject *parent = 0);

	Wishmaster::ThreadPtr thread() const { return m_thread; }


	static const int MaxAttachmentCount = 50;
	enum PostRoles
	{
		PostId = Qt::UserRole + 1,
		PosterName,
		PostSubject,
		PostVisibility,
		AttachmentBase,
		MaxAttachment = AttachmentBase + MaxAttachmentCount,
		AttachmentLinkBase,
		MaxAttachmentLink = AttachmentLinkBase + MaxAttachmentCount,
		AttachmentThumbBase,
		MaxAttachmentThumb = AttachmentThumbBase + MaxAttachmentCount,
		AttachmentThumbLinkBase,
		MaxAttachmentThumbLink = AttachmentThumbLinkBase + MaxAttachmentCount
	};

	inline int attachmentRole(int attach) const;
	inline int attachmentLinkRole(int attach) const;
	inline int attachmentThumbRole(int attach) const;
	inline int attachmentThumbLinkRole(int attach) const;

signals:

public slots:

private:
	Wishmaster::ThreadPtr m_thread;

};

#endif // THREADMODEL_H
